package com.atguigu;

import java.sql.*;
import java.util.Properties;

public class PhoenixJDBCApi {
    public static void main(String[] args) throws SQLException {
        Properties properties = new Properties();

        //1.获取jdbc链接
        Connection connection = DriverManager.getConnection("jdbc:phoenix:hadoop102,hadoop103,hadoop104:2181",properties);

        //2.获取语句预执行者
        PreparedStatement pstm = connection.prepareStatement("select * from STUDENT1");

        //3.执行sql获取到查询到的结果
        ResultSet resultSet = pstm.executeQuery();

        while (resultSet.next()) {
            System.out.println(resultSet.getString(1)+resultSet.getString(2)+resultSet.getString(3)+resultSet.getString(4));
        }

        connection.close();
    }
}
